import Loading from '@/components/loading/loading';

interface ButtonProps {
    type?: 'button' | "submit" | "reset";
    isLoading?: boolean;
    children: React.ReactNode;
    className?: string;
    isRounded?: boolean
}

export const Button = ({
    type = 'button',
    isLoading = false,
    children,
    className = '',
    isRounded = false,
    ...restProps
}: ButtonProps) => {
    return (
        <button type={type}
            disabled={isLoading}
            className={`button ${isRounded ? 'rounded-3xl' : ''} ${className}`}
            {...restProps}
        >
            {isLoading ? <Loading /> : children}
        </button>
    )
}


export const LoginBtn = ({ children, isLoading, ...restProps }: {
    children: React.ReactNode;
    isLoading?: boolean;
}
) => (
    <Button type="submit" isLoading={isLoading} className="mx-auto rounded-3xl w-44" {...restProps}>
        {children}
    </Button>
)

export const SubmitModalBtn = ({ children, ...restProps }: {
    children: React.ReactNode
}
) => (
    <Button
        type="submit"
        className="w-full max-w-xl mx-auto rounded-md btn lg:w-64 lg:ml-0"
        {...restProps}
    >
        {children}
    </Button>
)